<?php
class Ad extends CI_Model {
    public function __construct(){
        $this->load->database();
    }
    public function getAdByName($name){
        $code = '';
        $sql = "SELECT Code FROM Ad WHERE NAME = ?";
        $query = $this->db->query($sql, array($name));
        foreach ($query->result() as $row){
            $code = $row->Code;
        }
        return $code;
    }
}
?>
